package com.kll.tv.views

import android.content.Intent
import android.view.View
import com.kll.carolinehmibiz.AccountManager
import com.kll.carolinehmibiz.presentation.BasePresenter
import com.kll.tv.base.views.BaseActivity
import com.kll.tv.databinding.ActivityAccountSafetyBinding

/**
 * 账号与安全页
 */
class AccountSafetyActivity: BaseActivity<BasePresenter>() {
    private lateinit var binding: ActivityAccountSafetyBinding

    override fun initViewBinding(): View {
        binding = ActivityAccountSafetyBinding.inflate(layoutInflater)
        return binding.root
    }

    override fun createPresenter(): BasePresenter {
        return BasePresenter(this)
    }

    override fun init() {
        binding.tvAccountValue.text = AccountManager.getInstancce().getLoginUserInfo()?.mobile
        binding.tvPhone.text = AccountManager.getInstancce().getLoginUserInfo()?.mobile
        initListener()
    }

    private fun initListener() {
        binding.tvCancel.setOnClickListener {
            finish()
        }
        // 更换手机号
        binding.tvPhone.setOnClickListener {
            startActivity(Intent(this, UpdatePhoneActivity::class.java))
        }
        // 修改密码
        binding.tvResetPassword.setOnClickListener {
            startActivity(Intent(this, ResetPasswordActivity::class.java))
        }
    }
}